#include <iostream>
#include <vector>
#include <cstring>

using namespace std;

template <typename T>
int occur(vector<T> &v, const T &x)
{
    int count = 0;
    for (int i = 0; i < v.size(); i++)
    {
        if (v[i] == x)
            count++;
    }
    return count;
}

template <>
int occur(vector<char *> &v, char *const &x)
{
    cout << "specialized template" << endl;
    int count = 0;
    for (int i = 0; i < v.size(); i++)
    {
        if (strcmp(v[i], x) == 0)
            count++;
    }
    return count;
}

int main()
{
    vector<int> v1 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
    vector<char *> v3 = {"abc", "def", "ghi", "jkl", "mno", "pqr", "stu", "vwx", "yz"};

    cout << occur(v1, 5) << endl;
    cout << occur<char *>(v3, "jkl") << endl; // specialized template above
}